package com.qianfeng.missfood.fragment;

import android.content.Intent;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.qianfeng.missfood.BaseApp;
import com.qianfeng.missfood.R;
import com.qianfeng.missfood.ui.MyMsgActivity;
import com.qianfeng.missfood.utils.DataUtils;

/**
 * Created by Administrator on 15-8-20.
 */
public class MeFragment extends BaseAppFragment implements View.OnClickListener {
    @Override
    public int getLayoutRes() {
        return R.layout.fragment_me_layout;
    }

    @Override
    public void initView(View view) {

        TextView myNickName = (TextView) view.findViewById(R.id.myNickName);
        TextView myPhone = (TextView) view.findViewById(R.id.myPhone);
        RelativeLayout myLayout = (RelativeLayout) view.findViewById(R.id.myLayout);

        myNickName.setText(BaseApp.getInstance().getUser().getNickName());
        myPhone.setText(DataUtils.getPhone());

        myLayout.setOnClickListener(this);


    }

    @Override
    public void onClick(View v) {

        switch (v.getId()) {

            case R.id.myLayout:

                startAction(MyMsgActivity.class);
                break;

            default:

                break;


        }

    }

    private void startAction(Class<?> cls) {

        Intent intent = new Intent(getActivity(), cls);
        startActivity(intent);
    }
}
